
/***************************************************************************************
****************************************************************************************
* FILE		: battery.h
* Description	: 
*			  
* Copyright (c) 2020 by Simlife. All Rights Reserved.
* 
* History:
* Version		Name		Date				Description
   0.1		Alen			2020/05/07		Initial Version
   
****************************************************************************************
****************************************************************************************/

#ifndef _BATTERY_H_
#define _BATTERY_H_

#define batteryAdcPort _pb
#define batteryAdcPortAndPin _pb1
#define batteryAdcPin PIN_1
#define batteryAdcPinReverse PIN_1_REVERSE
#define batteryAdcTypeControl _pbc
#define batteryAdcPullUpControl _pbpu

#define chargeCheckPort _pb
#define chargeCheckPortAndPin _pb0
#define chargeCheckPin PIN_0
#define chargeCheckPinReverse PIN_0_REVERSE
#define chargeCheckTypeControl _pbc
#define chargeCheckPullUpControl _pbpu

#define chargeFullPort _pc
#define chargeFullPortAndPin _pc0
#define chargeFullPin PIN_0
#define chargeFullPinReverse PIN_0_REVERSE
#define chargeFullTypeControl _pcc
#define chargeFullPullUpControl _pcpu

// #define BATTERY_LOW_VALUE 2110   // 3.4	(1.7*4096)/(3.3)
// #define BATTERY_EMPTY_VALUE 2048 // 3.3	(1.65*4096)/(3.3)
// #define BATTERY_LOW_VALUE 2234   // 3.6	(1.8*4096)/(3.3)
// #define BATTERY_EMPTY_VALUE 2172 // 3.5	(1.75*4096)/(3.3)
#define BATTERY_LOW_VALUE 2172   // 3.5	(1.75*4096)/(3.3)
#define BATTERY_EMPTY_VALUE 2110 // 3.4	(1.7*4096)/(3.3)

extern void initBatteryAdcControlPin(void);
extern void initChargeCheckControlPin(void);
extern void batteryAdcProcess(void);
extern void chargeCheckProcess(void);

#endif /*_BATTERY_H_*/
